<?php
namespace app\common;

abstract class Context
{
    public function __construct($params = [])
    {
        if (!empty($params)) {
            $this->setParams($params);
        }
    }

    public function setParams($params = [])
    {
        if (empty($params)) {
            return $this;
        }

        foreach ($params as $k => $v) {
            if (property_exists($this, $k)) {
                $this->$k = $v;
            }
        }
        return $this;
    }
}
